package com.atguigu.oos.utils;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class ConstantPropertiesUtils implements InitializingBean {
    //读取配置文件内容
    @Value("${aliyun.oos.file.endpoint}")
    private String endpoint;
    @Value("${aliyun.oos.file.keyId}")
    private String keyId;
    @Value("${aliyun.oos.file.keySecret}")
    private String keySecret;
    @Value("${aliyun.oos.file.buckerName}")
    private String buckerName;

    public static String END_POINT;
    public static String KEY_ID;
    public static String KEY_SECRET;
    public static String BUCKER_NAME;

    //读取配置值后执行的方法
    @Override
    public void afterPropertiesSet() throws Exception {
        END_POINT=this.endpoint;
        KEY_ID=this.keyId;
        KEY_SECRET=this.keySecret;
        BUCKER_NAME=this.buckerName;
    }
}
